package wotd.web;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import wotd.VerseLookup;

import com.google.inject.Inject;
import com.google.inject.Singleton;

@Singleton
@SuppressWarnings("serial")
public class WotdServlet extends HttpServlet {
	/** finds excerpts */
	@Inject private VerseLookup lookup;
	
	@Override
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		String verse = lookup.getRandomVerse();
		
		resp.setContentType("text/html");
		resp.getWriter().print("<link rel=\"stylesheet\" href=\"verse.css\" type=\"text/css\">");
		resp.getWriter().print(verse);
		resp.getWriter().flush();
	}
}
